package com.ccc.ka.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import com.ccc.ka.util.KAResponse;
import org.springframework.web.bind.annotation.*;
import com.ccc.ka.service.IKeyService;
import com.ccc.ka.entity.Key;
import com.ccc.ka.util.BaseController;

/**
 * 
 * @author ccc
 * @since 2023-02-28
 */
@RestController
@RequestMapping("/key")
public class KeyController extends BaseController {

@Autowired
private IKeyService keyService;

@PostMapping("/saveKey")
public KAResponse saveKey(Key key){
    return success(keyService.save(key));
}

@DeleteMapping("/delKey")
public KAResponse delKey(Key key){
    return success(keyService.removeById(key));
}

@PutMapping("/updKey")
public KAResponse putKey(Key key){
    return success(keyService.updateById(key));
}

@GetMapping("/getKey")
public KAResponse getKey(String id){
    return success(keyService.getById(id));
}

@GetMapping("/getKeyList")
public KAResponse getKeyList(Key key){
    return success(keyService.list());
}

@GetMapping("/getKeyPage")
public KAResponse getKeyPage(Key key){
    return success(keyService.list());
}

}
